package com.example.service.impl;

import com.example.mapper.postListMapp;
import com.example.pojo.postListPojo;
import com.example.service.postListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * ClassName:postListImpl
 * Description:
 *
 * @Author 赵永峰
 * @Create 2025/9/27 19:38
 * @Version 1.0
 */
@Service
public class postListImpl implements postListService {
    @Autowired
    public postListMapp postListMapp;
    //插入一行数据
    public void insertOne(postListPojo pojo){
        //设置修改时间
        pojo.setUpdate_time(LocalDateTime.now());
        pojo.setCreate_time(LocalDateTime.now());
        postListMapp.insertOne(pojo);
    }
    //对岗位List根据某一个字段查询等于某一个值的所有值
    public List<postListPojo> inquiryOneFieldValue(Map<String, Object> map){
        //分解map内容
        String fieldName=(String) map.get("fieldName");
        String fieldVal=(String) map.get("fieldVal");
        List<postListPojo> pojos=postListMapp.inquiryOneFieldValue(fieldName,fieldVal);
        return pojos;
    }
    //辅助函数：岗位List表中，修改一行数据
    public void editOneRow(postListPojo pojo){
        //修改更新时间
        pojo.setUpdate_time(LocalDateTime.now());
        postListMapp.editOneRow(pojo);
    }
}
